﻿using System.Data.Entity;
using FinalProject.Data.DBInteractions.Interfaces;

namespace FinalProject.Data.DBInteractions
{
    public class DBFactory : Disposable, IDBFactory
    {
        public DBFactory()
        {

        }
        private FinalProjectContext dataContext;
        public FinalProjectContext Get()
        {
            return dataContext ?? (dataContext = new FinalProjectContext());
        }
        protected override void DisposeCore()
        {
            if (dataContext != null)
                dataContext.Dispose();
        }
    }
}
